<?php
include("../meihe/common.php");
if (empty($_SERVER['HTTP_REFERER'])) {
	header("Location: http://www.baidu.com/");
	exit;
}

if (!stristr($_SERVER['HTTP_REFERER'], 'www.zibll.com') && !stristr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
	header("Location: http://www.baidu.com/");
	exit;
}

if (strpos($user_agent, 'QQ/') == false && strpos($user_agent, 'MicroMessenger') == false) {
	header("Location: http://www.baidu.com/");
	exit;
}

$id = $_SERVER["QUERY_STRING"];
$row = $DB->get_row("SELECT * FROM meihe_report WHERE uid='{$id}' limit 1");
if (in_array($row['url'], explode("|", $conf['lhbamd']))) {
	sysmsg('<h3>当前域名已被拉黑，无法查看！</h3>');
	exit(0);
}
if (!$row) {
	sysmsg('<h3>当前链接不存在，可能没有生成过或已被删记录！</h3>');
	exit(0);
} else {
	session_start();
	$_SESSION['visited_s'] = true;
	$t_url = $row['url'];
	$link = $t_url;
	header("Location: $link ");
}